﻿<Window x:Class="CodeSHARPer.View.Dialogs.CodePropertiesView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
        xmlns:cinch="clr-namespace:Cinch;assembly=Cinch.WPF"
        Title="Preferences" Height="600" Width="600" 
        Icon="..\..\Themes\Images\App\Ico\app.preferences.ico" ShowInTaskbar="False"
        WindowStartupLocation="CenterOwner" WindowStyle="ToolWindow">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TabControl HorizontalAlignment="Stretch" Margin="3" VerticalAlignment="Stretch" Grid.Row="0">
            <TabItem Header="Code Editor">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <TextBlock Text="Font:" Margin="5" Padding="3" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Right"/>
                    <ComboBox HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Margin="5" MinWidth="150"
                              Grid.Column="1" Grid.Row="0"
                              ItemsSource="{Binding Fonts, IsAsync=True}"
                              SelectedItem="{Binding SeletecFont}">
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock FontFamily="{Binding }" Text="{Binding IsAsync=True}"/>
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                    </ComboBox>

                    <TextBlock Text="Size:" Margin="5" Padding="3" Grid.Column="2" Grid.Row="0" HorizontalAlignment="Right"/>
                    <TextBox HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" Margin="5"
                             Grid.Column="3" Grid.Row="0"
                             Text="{Binding FontSize}">
                        <i:Interaction.Behaviors>
                            <cinch:NumericTextBoxBehaviour/>
                        </i:Interaction.Behaviors>
                    </TextBox>

                    <CheckBox Content="Show line numbers" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="1" Margin="5"
                              IsChecked="{Binding ShowLineNumbers}"/>

                    <CheckBox Content="Allow scroll below document" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="2" Margin="5"
                              IsChecked="{Binding TextEditorOptions.AllowScrollBelowDocument}">
                        <CheckBox.ToolTip>
                            <StackPanel Orientation="Vertical">
                                <TextBlock Text="Sets whether the user can scroll below the bottom of the document."/>
                                <TextBlock Text="The default value is false, but it a good idea to set this property to true when using folding."/>
                            </StackPanel>
                        </CheckBox.ToolTip>
                    </CheckBox>

                    <CheckBox Content="Show column ruler" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="3" Margin="5"
                              IsChecked="{Binding TextEditorOptions.ShowColumnRuler}"
                              ToolTip="Sets whether the column ruler should be shown."/>

                    <TextBlock Text="Column ruler position:" Grid.Column="2" Grid.Row="3" Margin="5" HorizontalAlignment="Right"
                               ToolTip="Sets where the column ruler should be shown."/>

                    <TextBox Grid.Column="3" Grid.ColumnSpan="2" Grid.Row="3" Margin="5"
                             Text="{Binding TextEditorOptions.ColumnRulerPosition}">
                        <i:Interaction.Behaviors>
                            <cinch:NumericTextBoxBehaviour/>
                        </i:Interaction.Behaviors>
                    </TextBox>

                    <CheckBox Content="Convert tabs to spaces" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="4" Margin="5"
                              IsChecked="{Binding TextEditorOptions.ConvertTabsToSpaces}"
                              ToolTip="Sets whether to use spaces for indentation instead of tabs."/>

                    <CheckBox Content="Cut Copy whole line" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="5" Margin="5"
                              IsChecked="{Binding TextEditorOptions.CutCopyWholeLine}"
                              ToolTip="Sets whether copying without a selection copies the whole current line."/>

                    <CheckBox Content="Enable hyperlinks" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="6" Margin="5"
                              IsChecked="{Binding TextEditorOptions.EnableHyperlinks}"
                              ToolTip="Sets whether to enable clickable hyperlinks in the editor."/>

                    <CheckBox Content="Enable email hyperlinks" Grid.Column="2" Grid.ColumnSpan="2" Grid.Row="6" Margin="5"
                              IsChecked="{Binding TextEditorOptions.EnableEmailHyperlinks}"
                              ToolTip="Sets whether to enable clickable hyperlinks for e-mail addresses in the editor."/>

                    <CheckBox Content="Require control modifier for hyperlink click" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="7" Margin="5"
                              IsChecked="{Binding TextEditorOptions.RequireControlModifierForHyperlinkClick}"
                              ToolTip="Sets whether the user needs to press Control to click hyperlinks."/>

                    <CheckBox Content="Enable rectangular selection" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="8" Margin="5"
                              IsChecked="{Binding TextEditorOptions.EnableRectangularSelection}"
                              ToolTip="Enables rectangular selection (press ALT and select a rectangle)."/>

                    <CheckBox Content="Enable text drag drop" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="9" Margin="5"
                              IsChecked="{Binding TextEditorOptions.EnableTextDragDrop}"
                              ToolTip="Enable dragging text within the text area."/>

                    <CheckBox Content="Enable virtual space" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="10" Margin="5"
                              IsChecked="{Binding TextEditorOptions.EnableVirtualSpace}">
                        <CheckBox.ToolTip>
                            <StackPanel Orientation="Vertical">
                                <TextBlock Text="Sets whether the user can set the caret behind the line ending (into virtual space)."/>
                                <TextBlock Text="Note that virtual space is always used (independent from this setting) when doing rectangle selections."/>
                            </StackPanel>
                        </CheckBox.ToolTip>
                    </CheckBox>

                    <CheckBox Content="Show box for control characters" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="11" Margin="5"
                              IsChecked="{Binding TextEditorOptions.ShowBoxForControlCharacters}"
                              ToolTip="Sets whether to show a box with the hex code for control characters."/>

                    <CheckBox Content="Show end of line" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="12" Margin="5"
                              IsChecked="{Binding TextEditorOptions.ShowEndOfLine}"
                              ToolTip="Sets whether to show ¶ at the end of lines."/>

                    <CheckBox Content="Show spaces" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="13" Margin="5"
                              IsChecked="{Binding TextEditorOptions.ShowSpaces}"
                              ToolTip="Sets whether to show · for spaces."/>

                    <CheckBox Content="Show tabs" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="14" Margin="5"
                              IsChecked="{Binding TextEditorOptions.ShowTabs}"
                              ToolTip="Sets whether to show » for tabs."/>

                    <CheckBox Content="Enable ime support" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="15" Margin="5"
                              IsChecked="{Binding TextEditorOptions.EnableImeSupport}"
                              ToolTip="Sets whether the support for Input Method Editors (IME) for non-alphanumeric scripts (Chinese, Japanese, Korean, ...) is enabled."/>

                    <TextBlock Text="Word wrap indentation:" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="16" Margin="5" HorizontalAlignment="Right"
                               ToolTip="Sets the indentation used for all lines except the first when word-wrapping."/>

                    <TextBox Grid.Column="2" Grid.ColumnSpan="2" Grid.Row="16" Margin="5"
                             Text="{Binding TextEditorOptions.WordWrapIndentation}">
                        <i:Interaction.Behaviors>
                            <cinch:NumericTextBoxBehaviour/>
                        </i:Interaction.Behaviors>
                    </TextBox>
                </Grid>
            </TabItem>

            <TabItem Header="Application">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <GroupBox Header="Application Folders" Grid.Row="0">
                        <DockPanel>
                            <TextBox Text="{Binding FolderPath}" DockPanel.Dock="Left" Margin="5" Padding="3" HorizontalAlignment="Stretch" BorderThickness="0"/>
                            <Button Content="..." Command="{Binding ChooseFolderPathCommand}" DockPanel.Dock="Right" Margin="5" Padding="5, 0, 5, 5" Width="25" HorizontalAlignment="Right"/>
                        </DockPanel>
                    </GroupBox>
                </Grid>
            </TabItem>
        </TabControl>

        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="OK" Width="75" IsDefault="True" Margin="5" Padding="3"
                    Command="{Binding CloseActivePopUpCommand}" CommandParameter="True" />
            <Button Content="Cancel" Width="75" IsCancel="True" Margin="5" Padding="3"/>
        </StackPanel>
    </Grid>
</Window>
